<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>图结构及其算法单元测试</title>
    <!--注意：// 需要在支持 ES6 的环境下执行-->
    <script type="module">
        const graph_dfs = [
            [8, 6],
            [0, 1],
            [0, 2],
            [1, 3],
            [1, 4],
            [2, 3],
            [5, 6]
        ]

        //-----------------------------测试图 floodfill 算法---------------------------------------------
        import {AdjSet} from '../AdjSet.js'
        import {CCMaxCount} from './CCMaxCount.js'
        function testCCMaxCount() {
            const ccMaxCount = new CCMaxCount(new AdjSet(graph_dfs))
            alert("图中最大连通分量包含的顶点数：\n" + ccMaxCount.getMaxVertexNum())
        }

        const grid = [
            [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
            [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
            [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
            [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
            [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
            [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
        ]

        import {MaxAreaOfIsland} from './MaxAreaOfIsland.js'
        function testMaxAreaOfIsland() {
            const maxAreaOfIsland = new MaxAreaOfIsland()
            alert("最大岛屿的面积是：\n" + maxAreaOfIsland.maxAreaOfIsland(grid))
        }

        import {MaxAreaOfIsland1} from './MaxAreaOfIsland1.js'
        function testMaxAreaOfIsland1() {
            const maxAreaOfIsland = new MaxAreaOfIsland1()
            alert("最大岛屿的面积是：\n" + maxAreaOfIsland.maxAreaOfIsland(grid))
        }

        import {MaxAreaOfIsland2} from './MaxAreaOfIsland2.js'
        function testMaxAreaOfIsland2() {
            const maxAreaOfIsland = new MaxAreaOfIsland2()
            alert("最大岛屿的面积是：\n" + maxAreaOfIsland.maxAreaOfIsland(grid))
        }

        import {MaxAreaOfIsland3} from './MaxAreaOfIsland3.js'
        function testMaxAreaOfIsland3() {
            const maxAreaOfIsland = new MaxAreaOfIsland3()
            alert("最大岛屿的面积是：\n" + maxAreaOfIsland.maxAreaOfIsland(grid))
        }

        // 所有功能的测试触发，可以通过注释达到测试某个动能的目的
        //testCCMaxCount()
        //testMaxAreaOfIsland()
        //testMaxAreaOfIsland1()
        //testMaxAreaOfIsland2()
        testMaxAreaOfIsland3()

    </script>
</head>
<body>

</body>
</html>